package com.hqyj.crmdemo.entity;

import java.util.List;

public class RestResult<T> {
    private Integer code; // 用于标志后台方法执行是否成功( 1表示成功， 0表示失败)
    private String msg; // 提示成功
    private Long total;//传输总数
    private T obj; // 返回的单个对象
    private List<T> list; // 返回的是一个集合
    private List<T> listFamily; // 返回的是一个集合

    // 提供构造函数
    public RestResult() {
    }

    public RestResult(Integer code) {
        this.code = code;
    }

    public RestResult(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public RestResult(Integer code, String msg, T obj) {
        this.code = code;
        this.msg = msg;
        this.obj = obj;
    }

    public RestResult(Integer code, String msg, List<T> list) {
        this.code = code;
        this.msg = msg;
        this.list = list;
    }

    public RestResult(Integer code, List<T> list) {
        this.code = code;
        this.list = list;
    }

    public RestResult(Integer code, List<T> list,List<T> listFamily) {
        this.code = code;
        this.list = list;
        this.listFamily = listFamily;
    }

    public RestResult(Integer code, T obj) {
        this.code = code;
        this.obj = obj;
    }

    public RestResult(Integer code, List<T> list, Long total) {
        this.code = code;
        this.list = list;
        this.total = total;
    }

    // 提供静态方法
    public static <T> com.hqyj.crmdemo.entity.RestResult<T> ok() {
        return new com.hqyj.crmdemo.entity.RestResult<T>(1);
    }

    public static <T> com.hqyj.crmdemo.entity.RestResult<T> ok(String msg) {
        return new com.hqyj.crmdemo.entity.RestResult<T>(1, msg);
    }

    public static <T> com.hqyj.crmdemo.entity.RestResult<T> ok(String msg, T obj) {
        return new com.hqyj.crmdemo.entity.RestResult<T>(1, msg,obj);
    }

    public static <T> com.hqyj.crmdemo.entity.RestResult<T> ok(T obj) {
        return new com.hqyj.crmdemo.entity.RestResult<T>(1, obj);
    }

    public static <T> com.hqyj.crmdemo.entity.RestResult<T> ok(List<T> list) {
        return new com.hqyj.crmdemo.entity.RestResult<T>(1, list);
    }

    public static <T> com.hqyj.crmdemo.entity.RestResult<T> ok(List<T> list,List<T> listFamily) {
        return new com.hqyj.crmdemo.entity.RestResult<T>(1, list,listFamily);
    }

    public static <T> com.hqyj.crmdemo.entity.RestResult<T> ok(List<T> list, Long total) {
        return new com.hqyj.crmdemo.entity.RestResult<T>(1, list, total);
    }


    public RestResult(Integer code, String msg, Long total, T obj, List<T> list) {
        this.code = code;
        this.msg = msg;
        this.total = total;
        this.obj = obj;
        this.list = list;
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getObj() {
        return obj;
    }

    public void setObj(T obj) {
        this.obj = obj;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public List<T> getListFamily() {
        return listFamily;
    }

    public void setListFamily(List<T> listFamily) {
        this.listFamily = listFamily;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }
}
